namespace WWW.SST.LIB
{
	using System;
	using System.IO;
	using System.Security.Cryptography;
	using System.Text;
//	using System;
//	using System.IO;
//	using System.Security.Cryptography;
//	using System.Text;
	


	//shenfarzhar
	public class EncryptDecrypt
	{
		private string sKey = "cm818com";

		public string Decrypt(string pToDecrypt)
		{
			DESCryptoServiceProvider provider = new DESCryptoServiceProvider();
			byte[] buffer = new byte[pToDecrypt.Length / 2];
			for (int i = 0; i < (pToDecrypt.Length / 2); i++)
			{
				int num2 = Convert.ToInt32(pToDecrypt.Substring(i * 2, 2), 0x10);
				buffer[i] = (byte) num2;
			}
			provider.Key = Encoding.ASCII.GetBytes(this.sKey);
			provider.IV = Encoding.ASCII.GetBytes(this.sKey);
			MemoryStream stream = new MemoryStream();
			CryptoStream stream2 = new CryptoStream(stream, provider.CreateDecryptor(), CryptoStreamMode.Write);
			stream2.Write(buffer, 0, buffer.Length);
			stream2.FlushFinalBlock();
			StringBuilder builder = new StringBuilder();
			return Encoding.Default.GetString(stream.ToArray());
		}

		public string Encrypt(string pToEncrypt)
		{
			DESCryptoServiceProvider provider = new DESCryptoServiceProvider();
			byte[] bytes = Encoding.Default.GetBytes(pToEncrypt);
			provider.Key = Encoding.ASCII.GetBytes(this.sKey);
			provider.IV = Encoding.ASCII.GetBytes(this.sKey);
			MemoryStream stream = new MemoryStream();
			CryptoStream stream2 = new CryptoStream(stream, provider.CreateEncryptor(), CryptoStreamMode.Write);
			stream2.Write(bytes, 0, bytes.Length);
			stream2.FlushFinalBlock();
			StringBuilder builder = new StringBuilder();
			foreach (byte num in stream.ToArray())
			{
				builder.AppendFormat("{0:X2}", num);
			}
			builder.ToString();
			return builder.ToString();
		}

		public string SecurityKey
		{
			get
			{
				return this.sKey;
			}
			set
			{
				this.sKey = value;
			}
		}
	}




	//login user
	public class  LoginEncrypt
	{
		private string sKey = "88250662";

		public string Decrypt(string pToDecrypt)
		{
			DESCryptoServiceProvider provider = new DESCryptoServiceProvider();
			byte[] buffer = new byte[pToDecrypt.Length / 2];
			for (int i = 0; i < (pToDecrypt.Length / 2); i++)
			{
				int num2 = Convert.ToInt32(pToDecrypt.Substring(i * 2, 2), 0x10);
				buffer[i] = (byte) num2;
			}
			provider.Key = Encoding.ASCII.GetBytes(this.sKey);
			provider.IV = Encoding.ASCII.GetBytes(this.sKey);
			MemoryStream stream = new MemoryStream();
			CryptoStream stream2 = new CryptoStream(stream, provider.CreateDecryptor(), CryptoStreamMode.Write);
			stream2.Write(buffer, 0, buffer.Length);
			stream2.FlushFinalBlock();
			StringBuilder builder = new StringBuilder();
			return Encoding.Default.GetString(stream.ToArray());
		}

		public string Encrypt(string pToEncrypt)
		{
			DESCryptoServiceProvider provider = new DESCryptoServiceProvider();
			byte[] bytes = Encoding.Default.GetBytes(pToEncrypt);
			provider.Key = Encoding.ASCII.GetBytes(this.sKey);
			provider.IV = Encoding.ASCII.GetBytes(this.sKey);
			MemoryStream stream = new MemoryStream();
			CryptoStream stream2 = new CryptoStream(stream, provider.CreateEncryptor(), CryptoStreamMode.Write);
			stream2.Write(bytes, 0, bytes.Length);
			stream2.FlushFinalBlock();
			StringBuilder builder = new StringBuilder();
			foreach (byte num in stream.ToArray())
			{
				builder.AppendFormat("{0:X2}", num);
			}
			builder.ToString();
			return builder.ToString();
		}

		public string SecurityKey
		{
			get
			{
				return this.sKey;
			}
			set
			{
				this.sKey = value;
			}
		}
	}




	//heutai login 
	public class SecurityZ8
	{
		private string sKey = "88312753";

		public string Decrypt(string pToDecrypt)
		{
			DESCryptoServiceProvider provider = new DESCryptoServiceProvider();
			byte[] buffer = new byte[pToDecrypt.Length / 2];
			for (int i = 0; i < (pToDecrypt.Length / 2); i++)
			{
				int num2 = Convert.ToInt32(pToDecrypt.Substring(i * 2, 2), 0x10);
				buffer[i] = (byte) num2;
			}
			provider.Key = Encoding.ASCII.GetBytes(this.sKey);
			provider.IV = Encoding.ASCII.GetBytes(this.sKey);
			MemoryStream stream = new MemoryStream();
			CryptoStream stream2 = new CryptoStream(stream, provider.CreateDecryptor(), CryptoStreamMode.Write);
			stream2.Write(buffer, 0, buffer.Length);
			stream2.FlushFinalBlock();
			StringBuilder builder = new StringBuilder();
			return Encoding.Default.GetString(stream.ToArray());
		}

		public string Encrypt(string pToEncrypt)
		{
			DESCryptoServiceProvider provider = new DESCryptoServiceProvider();
			byte[] bytes = Encoding.Default.GetBytes(pToEncrypt);
			provider.Key = Encoding.ASCII.GetBytes(this.sKey);
			provider.IV = Encoding.ASCII.GetBytes(this.sKey);
			MemoryStream stream = new MemoryStream();
			CryptoStream stream2 = new CryptoStream(stream, provider.CreateEncryptor(), CryptoStreamMode.Write);
			stream2.Write(bytes, 0, bytes.Length);
			stream2.FlushFinalBlock();
			StringBuilder builder = new StringBuilder();
			foreach (byte num in stream.ToArray())
			{
				builder.AppendFormat("{0:X2}", num);
			}
			builder.ToString();
			return builder.ToString();
		}

		public string SecurityKey
		{
			get
			{
				return this.sKey;
			}
			set
			{
				this.sKey = value;
			}
		}
	}

}

